﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Security.Cryptography;

public partial class Manager_PrivateInfo_show : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["AdminUserID"] == null || Session["IsAdmin"] != "S")
        {
            Response.Write("<script language=javascript>alert('Time is out.');window.open('../Default.aspx','_top');</script>");
            return;
        }  
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {

            if (txtName.Text.Length > 0)
            {
                RijndaelManaged mobjCryptoService = new RijndaelManaged();
                EncrypKey cls = new EncrypKey(mobjCryptoService);
                if (DropDownList1.SelectedValue == "D")
                    lblPass.Text = cls.Decrypting(txtName.Text, System.Configuration.ConfigurationManager.AppSettings["EncrypKey"]);
                else
                    lblPass.Text = cls.Encrypting(txtName.Text, System.Configuration.ConfigurationManager.AppSettings["EncrypKey"]);
            }
        }
        catch
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('Ký tự nhập vào không hợp lệ')</script>");
        }

    }
}
